home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2005 October / PCWOCT05.iso / Software / FromTheMag / Syn Text Editor 2.1.0.46 / synsetup-2.1.0.46.exe / {app} / scripts / mplhead.js < prev    next >
Text File  |  2003-08-13  |  6KB  |  137 lines

  1. // Caption: Add MPL Header|
  2. // Hint: Add syn MPL License Header at the Top|
  3. // Icon: mpl.ico|
  4. /*
  5.   syn
  6.   Copyright (C) 2000-2003, Ascher Stefan. All rights reserved.
  7.   stievie@utanet.at, http://web.utanet.at/ascherst/
  8.  
  9.   The contents of this file are subject to the Mozilla Public License
  10.   Version 1.1 (the "License"); you may not use this file except in compliance
  11.   with the License. You may obtain a copy of the License at
  12.   http://www.mozilla.org/MPL/
  13.  
  14.   Software distributed under the License is distributed on an "AS IS" basis,
  15.   WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
  16.   the specific language governing rights and limitations under the License.
  17.  
  18.   The Original Code is mplhead.js, released Wed, 22 May 2002 10:37:17 UTC.
  19.  
  20.   The Initial Developer of the Original Code is Ascher Stefan.
  21.   Portions created by Ascher Stefan are Copyright (C) 2000-2003 Ascher Stefan.
  22.   All Rights Reserved.
  23.  
  24.   Contributor(s): .
  25.  
  26.   Alternatively, the contents of this file may be used under the terms of the
  27.   GNU General Public License Version 2 or later (the "GPL"), in which case
  28.   the provisions of the GPL are applicable instead of those above.
  29.   If you wish to allow use of your version of this file only under the terms
  30.   of the GPL and not to allow others to use your version of this file
  31.   under the MPL, indicate your decision by deleting the provisions above and
  32.   replace them with the notice and other provisions required by the GPL.
  33.   If you do not delete the provisions above, a recipient may use your version
  34.   of this file under either the MPL or the GPL.
  35.  
  36.   You may retrieve the latest version of this file at the syn home page,
  37.   located at http://syn.sourceforge.net/
  38.  
  39.  $Id: mplhead.js,v 1.2.2.5 2003/08/13 00:38:45 neum Exp $
  40. */
  41.  
  42. //#include <consts>
  43. //#include <cmnfunc>
  44.  
  45. function Main()
  46. {
  47.   if (Project.Loaded)
  48.     ProjectName = InputBox('MPL', 'Enter the Project Name', Project.FriendlyName);
  49.   else
  50.     ProjectName = InputBox('MPL', 'Enter the Project Name', ActiveDocument.Title);
  51.   if (ProjectName == '')
  52.     return;
  53.   Author = 'Ascher Stefan';
  54.   Email = 'stievie@utanet.at';
  55.   Contribs = '';
  56.   URL1 = 'http://web.utanet.at/ascherst/';
  57.   URL2 = 'http://syn.sourceforge.net/';
  58.   
  59.   synlic = new Array(
  60.     '',
  61.     '$[Project]',
  62.     'Copyright (C) $[Year], $[Author]. All rights reserved.',
  63.     '$[Email], $[URL1]',
  64.     '',
  65.     'The contents of this file are subject to the Mozilla Public License',
  66.     'Version 1.1 (the "License"); you may not use this file except in compliance',
  67.     'with the License. You may obtain a copy of the License at',
  68.     'http://www.mozilla.org/MPL/',
  69.     '',
  70.     'Software distributed under the License is distributed on an "AS IS" basis,',
  71.     'WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for',
  72.     'the specific language governing rights and limitations under the License.',
  73.     '',
  74.     'The Original Code is $[FileTitle], released $[Date].',
  75.     '',
  76.     'The Initial Developer of the Original Code is $[Author].',
  77.     'Portions created by $[Author] are Copyright (C) $[Year] $[Author].',
  78.     'All Rights Reserved.',
  79.     '',
  80.     'Contributor(s): $[Contribs].',
  81.     '',
  82.     'Alternatively, the contents of this file may be used under the terms of the',
  83.     'GNU General Public License Version 2 or later (the "GPL"), in which case',
  84.     'the provisions of the GPL are applicable instead of those above.',
  85.     'If you wish to allow use of your version of this file only under the terms',
  86.     'of the GPL and not to allow others to use your version of this file',
  87.     'under the MPL, indicate your decision by deleting the provisions above and',
  88.     'replace them with the notice and other provisions required by the GPL.',
  89.     'If you do not delete the provisions above, a recipient may use your version',
  90.     'of this file under either the MPL or the GPL.',
  91.     '',
  92.     'You may retrieve the latest version of this file at the $[Project] home page,',
  93.     'located at $[URL2]',
  94.     ''
  95.   );
  96.   
  97.   if (Documents.Count == 0)
  98.     return false;
  99.  
  100.   var x = ActiveDocument.CaretX;
  101.   var y = ActiveDocument.CaretY;
  102.   var t = ActiveDocument.TopLine;
  103.   var id = String.fromCharCode(32, 36, 73, 100, 58, 32, 36);     // Id:
  104.   ActiveDocument.ExecEditCommand(ecEditorTop);
  105.   ActiveDocument.SelText = '';
  106.   with (ActiveDocument.Lines) {
  107.     Insert(0, '');
  108.     Insert(0, id);
  109.     var d = new Date();
  110.     for (var i = synlic.length - 1; i >= 0; i--) {
  111.       if (synlic[i] != '') {
  112.         var instext = new String(synlic[i]);
  113.         instext = instext.replace(/\$\[Project\]/g, ProjectName);
  114.         instext = instext.replace(/\$\[Author\]/g, Author);
  115.         instext = instext.replace(/\$\[Email\]/g, Email);
  116.         instext = instext.replace(/\$\[FileTitle\]/g, ActiveDocument.Title);
  117.         instext = instext.replace(/\$\[Date\]/g, d.toUTCString());
  118.         instext = instext.replace(/\$\[Year\]/g, d.getYear());
  119.         instext = instext.replace(/\$\[Contribs\]/g, Contribs);
  120.         instext = instext.replace(/\$\[URL1\]/g, URL1);
  121.         instext = instext.replace(/\$\[URL2\]/g, URL2);
  122.         Insert(0, '  ' + instext);
  123.       } else {
  124.         Insert(0, '');
  125.       }
  126.     }
  127.   }
  128.   ActiveDocument.SelectRange(1, 1, 1, synlic.length + 3);
  129.   ActiveDocument.ExecCommand(scEComment);                            // Comment it
  130.   ActiveDocument.SelectRange(1, 1, 1, 1);
  131. //    ActiveDocument.CaretX = x;
  132. //    ActiveDocument.CaretY = y + gpl.length;
  133. //    ActiveDocument.TopLine = t + gpl.length;
  134.   ActiveDocument.Modified = true;
  135.   return true;
  136. }
  137.